package data

import (
	"flag"

	"git.cloud.inspur.com/ichain/ichain-sdk-go/pkg/client/chain"
	"git.cloud.inspur.com/ichain/ichain-sdk-go/pkg/core/config"
)

var (
	flagEnv string
)

func init() {
	flag.StringVar(&flagEnv, "env", "137", "env config")
}

type Env interface {
	SdkBuilder() *config.Builder
	ClientCert() []byte
	ClientPvk() []byte
	ChainId() string
	RandInvokeFunc() chain.Request
	RandInodeName() string
	AdminCert() []byte
	AdminKey() []byte
}

func GetEnvFromFlag() Env {
	return GetEnv(flagEnv)
}

func GetEnv(tag string) Env {
	var env Env
	switch tag {
	case "137sw":
		env = Baas137Sw()
	case "137":
		env = Baas137()
	case "137gm":
		env = Baas137GM()
	}
	return env
}
